/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#include "stdafx.h"
#include "pch.h"
#include "缓存.h"

//S_板载缓存* g_自定义属性索引 = nullptr;

static S_Scene* g_Scene = 0;

struct S_TexArrayRes* S_全局缓存::g_默认图标 = nullptr;


S_纹理*			S_全局缓存::g_空纹理		= nullptr;
S_纹理采样器*	S_全局缓存::g_默认采样器	= nullptr;


std::atomic_int32_t	S_全局缓存::m_着色器引用数量	= 0;
S_板载缓存*			S_全局缓存::g_属性索引			= nullptr;




S_全局缓存& f_buf_getGlobal() {
	static S_全局缓存 buffer{};
	return buffer;
}

void f_NodeCtx_set默认场景(S_Scene* scene) {
	g_Scene = scene;
}

S_Scene* f_NodeCtx_get默认场景() {
	return g_Scene;
}

S_缺损纹理& f_g_纹理(uint32 设备) {
	static S_缺损纹理 buffer{};
	return buffer;
}

S_预设材质& f_g_预设材质(uint32 设备) {
	static S_预设材质 buffer{};
	return buffer;
}


